package com.lagou.rpc.provider;

import com.lagou.rpc.provider.server.RpcServer;
import com.lagou.rpc.provider.zk.ZkRegister;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class serveBootStrapApplocaton  implements CommandLineRunner {
    @Autowired
    RpcServer rpcServer;
    public static void main(String[] args) {
        SpringApplication.run(serveBootStrapApplocaton.class,args);
    }

    @Override
    public void run(String... args) throws Exception {
        new Thread(()->{
            try {
                rpcServer.startSever();
                //注册服务
                ZkRegister.restister();

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }).start();

    }
}
